package com.jiulong.service.Impl;


import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;













import com.jiulong.dao.TGiftMapper;
import com.jiulong.dao.TOrderMapper;
import com.jiulong.dao.TOrderdetailMapper;
import com.jiulong.dao.TOrdershipMapper;
import com.jiulong.model.TAccountExample;
import com.jiulong.model.TGift;
import com.jiulong.model.TGiftExample;
import com.jiulong.model.TOrder;
import com.jiulong.model.TOrderExample;
import com.jiulong.model.TOrderdetail;
import com.jiulong.model.TOrdership;
import com.jiulong.service.OrderService;
@Service
public class OrderServiceImpl implements OrderService{
	@Autowired
	TOrderMapper tOrderMapper;
	@Autowired
	TOrdershipMapper TOrdershipMapper;
	@Autowired
	TGiftMapper tGiftMapper;
	@Autowired
	TOrderdetailMapper TOrderdetailMapper;
	@Override
	public TOrder insertOrder(TOrder order) {
	
		
		tOrderMapper.insert(order);
		return null;	
	}

	@Override
	public List findOrderDetailByOpenid(String account) {
		
		
		TOrderExample example=new TOrderExample();
		example.createCriteria().andAccountEqualTo(account).andPaystatusEqualTo("n");
		List<TOrder>list= tOrderMapper.selectByExample(example);
		
		//System.out.println("我的订单回显到前端页面的价格"+list.get(0).getAmount());
	/*	System.out.println(list.get(0).getExpressno());
		System.out.println(list.get(1).getAccount());
		System.out.println(list.get(2).getAccount());*/
		return list;		
	}

	@Override
	public List findGiftbyId(String nickname) {
		
		TGiftExample example=new TGiftExample();
		example.createCriteria().andStatusEqualTo(nickname);
		List<TGift>gift= tGiftMapper.selectByExample(example);
		
		return gift;
	}

	@Override
	public TOrderdetail insertOrderDetail(TOrderdetail detail) {
		System.out.println("正在插入详细信息");
		TOrderdetailMapper.insert(detail);
		return null;
	}

	@Override
	public  TOrdership insertOrderShip(TOrdership ship) {
		System.out.println("正在插入ship详细信息");
		TOrdershipMapper.insert(ship);
		return null;
	
	}
	
}
